Imports CapaDeDatos
Public Class nConcepto
    Public Concepto As CapaDeDatos.dConcepto = New CapaDeDatos.dConcepto()
    Public Imputacion As CapaDeDatos.dImputacion = New CapaDeDatos.dImputacion
    Public Function InsertarConcepto(ByVal Descripcion As String, ByVal Iva As String, _
    ByVal CodigoImputacion As String, ByVal Tipo As String) As Boolean
        Return Concepto.Insertar(Descripcion, Iva, CodigoImputacion, Tipo)
    End Function
    Public Function Existe(ByVal Descripcion As String, ByVal Tipo As String) As Boolean
        Return Concepto.Existe(Descripcion, Tipo)
    End Function

    Public Function ListarConcepto(ByVal CodigoConcepto As Integer, ByVal Descripcion As String, ByVal Iva As String, _
                        ByVal CodigoImputacion As Integer, ByVal Tipo As String) As DataSet
        Return Concepto.ListarConceptos(CodigoConcepto, Descripcion, Iva, CodigoImputacion, Tipo)
    End Function
    Public Function PasarImputacion(ByVal Codigoconcepto As Integer) As Integer
        Return Concepto.PasarImputacion(Codigoconcepto)
    End Function
    Public Function EliminarConcepto(ByVal CodigoConcepto As Integer) As Boolean
        Return Concepto.Eliminar(CodigoConcepto)
    End Function
    Public Function ModificarConcepto(ByVal CodigoConcepto As Integer, ByVal Descripcion As String, _
                ByVal Iva As String, ByVal CodigoImputacion As String, ByVal Tipo As String) As Boolean
        Return Concepto.Modificar(CodigoConcepto, Descripcion, Iva, CodigoImputacion, Tipo)
    End Function
    Public Function MostrarDescripcion(ByVal CodigoConcepto As Integer, ByVal Descripcion As String) As String
        Return Concepto.MostrarDesc(CodigoConcepto, Descripcion)
    End Function
    Public Function DarIva(ByVal CodigoConcepto As Integer) As Double
        Return Concepto.DarIvaConcepto(CodigoConcepto)
    End Function
    Public Function ListarTodo(ByVal CodigoConcepto As Integer, ByVal Descripcion As String, ByVal Iva As String, _
                        ByVal CodigoImputacion As String, ByVal Tipo As String) As DataSet
        Dim dtsPrincipal As DataSet
        dtsPrincipal = Concepto.ListarConceptos(CodigoConcepto, Descripcion, Iva, CodigoImputacion, Tipo)
        dtsPrincipal.Tables(0).Columns.Add("DescripcionImp")
        Dim i As Integer
        For i = 0 To dtsPrincipal.Tables(0).Rows.Count - 1
            Try
                dtsPrincipal.Tables(0).Rows(i)("DescripcionImp") = Imputacion.BuscarFiltrado(dtsPrincipal.Tables(0).Rows(i)("CodigoImputacion").ToString(), "", "").Tables(0).Rows(0)("DescripcionImp").ToString()
            Catch ex As Exception
                dtsPrincipal.Tables(0).Rows(i)("DescripcionImp") = "Error, Imputacion no Encontrada"
            End Try
        Next
        Return dtsPrincipal
    End Function
End Class
